<template>
	<view>
<pagestatus v-if="status.code !=200" :status="status" 
v-on:btnclick="getDetail"
></pagestatus>
<block v-else>
<view class="foot2">
<view class="b" @click="tzurl">{{thread['title']}}</view>
<view class="huise">发布时间：{{thread.timestr}}</view>
</view>
<view class="xfdiv2" @click="goto" data-mode="prv" :style="'top:'+h2">←</view>
<view class="xfdiv" @click="goto" data-mode="next" :style="'top:'+h2">→</view>
<!-- #ifdef MP-WEIXIN || MP-QQ -->
<txv-video :enableDanmu="true" :danmuBtn="true" :vid="thread.vs" width="100%" :height="h" playerid="txv0" :autoplay="true" controls=true defn="超清" playBtnPosition="center" showProgress=true>
</txv-video>
<!-- #endif -->
<!-- #ifndef MP-WEIXIN || MP-QQ -->
 <web-view :src="'https://09love.44api.com/qqpayer2.html?vid='+thread.vs"></web-view>
<!-- #endif -->
	</block>
	</view>
</template>

<script>
var __self=false;/*this的优化 */
//#ifdef MP-WEIXIN || MP-QQ
const TxvContext = requirePlugin("tencentvideo");
var txvContext =false;
var current=0
 //#endif 
var p = {
title: getApp().globalData.ysv8set.title,
id: 0,
img:getApp().globalData.ysv8set.img,
timglist:[]
}
function getimgsrc(htmlstr) {  
    var reg = /<img.+?src=('|")?([^'"]+)('|")?(?:\s+|>)/gim;  
    var imgsrcArr = []; 
	 var tem=[];
    while (tem = reg.exec(htmlstr)) {  
        imgsrcArr.push(tem[2]);  
    }  
    return imgsrcArr;  
}
import yad from '@/components/yad.vue'
import pagestatus from '@/components/page-status.vue'
export default {
		components: {
			yad,pagestatus
		},
data() {
return {
h2:getApp().globalData.height2,
h:getApp().globalData.height,
anz: getApp().globalData.ysv8set.anz,
favbool: !1,
thread: false,
imgswt: getApp().globalData.ysv8set.imgswt,
loadingType: "more",
    status:{
        loading:true,
        icon:'content',
        title:'页面加载中...',
        desc:'',
        showBtn:false,
        btnText:'',
        code:199
    },
				}
},onLoad: function(t) {
        if (!t.id) uni.navigateBack({});
        __self = this;
        p.id = t.id;
this.getDetail()
if(getApp().globalData.height=='auto')
uni.getSystemInfo({
success: res => {
getApp().globalData.height=res.windowHeight*750/res.windowWidth+'rpx'
getApp().globalData.height2=res.windowHeight*375/res.windowWidth+'rpx'

__self.h=getApp().globalData.height
__self.h2=getApp().globalData.height2
}
});
},onShareAppMessage: function() {
        uni.setClipboardData({data:p.title});
        return {
            title: p.title,
            content: p.title,
            path: "/pageb/v/t?id=" + p.id,
            imageUrl: p.img
        }
},methods:{
 tzurl: function() {
let urla=__self.thread.url.split('[@]')
if(urla.length<2) return false;
switch(urla[0]) {
     case 'ht':
uni.navigateTo({
    url: '/pages/ht/t?id='+Number(urla[1])
});
        break;
 case 'www':
uni.navigateTo({
    url: '/pages/www/t?id='+Number(urla[1])
});
        break;
 case 'zh':
uni.navigateTo({
    url: '/pageb/zh/t?id='+Number(urla[1])
});
        break;
		case 'wyq':
		uni.navigateTo({
		    url: '/pageb/wyq/t?id='+Number(urla[1])
		});
		        break;
	case 'shop':
		uni.navigateTo({
		    url: '/pageb/shop/t?id='+Number(urla[1])
		});
		        break;
  
} 	
},
    copytxt: function() {
        var a = __self.thread.title;
        a = a.replace(/[|]*\n/, "");
        a = a.replace(/<\/?[^>]*>/g, "");
        a = a.replace(/&npsp;/gi, "");
        uni.setClipboardData({
            data: getApp().globalData.ysv8set.title2 + a + "\n"+getApp().globalData.ysv8set.www+'ht/' + p.id + ".html"
        })
    },
   
getDetail: function() {
uni.request({
url: getApp().globalData.ysv8set.www + "v/" + p.id + ".api",
cloudCache:getApp().globalData.ysv8set.cloudCache,
data: {},
success: function(e) {
if ("200" != e.data.code)
return  uni.showModal({
    title: '错误提示',
    content: e.data["info"],
    confirmText: '确定',
		showCancel:false,
    success() {
       
                uni.redirectTo({
                    url: '/pageb/v/index'
                });
          

    }
});
p.img = 'https://puui.qpic.cn/qqvideo_ori/0/'+e.data.thread_data.vs+'_360_204/0'
p.timglist = [p.img];

p.title = e.data.thread_data["title"];
e.data.thread_data["timestr"] = getApp().globalData.ysv8set.timeStamp2String(e.data.thread_data['btime'], !0);
__self.thread=e.data.thread_data,

__self.status={
title:'加载完成',
showBtn:false,
code:200
}
},fail: function() {
__self.status={
title:'网络错误',
desc:'网络连接错误',
showBtn:true,
btnText:'重新加载',
code:400
 }
}
})
},goto: function(k) {
 uni.request({
 method:"GET",
 url: getApp().globalData.ysv8set.www +'v/'+k.target.dataset.mode+'/'+__self.thread.btime+'.api',
 success: (res) => {

if('id' in res.data)
uni.redirectTo({url: '/pageb/v/t?id='+res.data.id});
else
uni.showToast({
    title: '没有数据了',
    duration: 2000
});
	 },
	 });
}
	
	
}
}
</script>

<style>
.xfdiv{z-index:999;position:fixed;bottom:350upx;width:100upx;  line-height:100upx;background-color:#fbf8f9;text-align:center; right: 20upx; border-radius: 100upx;
height: 100upx; overflow: hidden;border:thin solid #d9d7d3; font-weight: bold; color:green; font-size:60upx;
}
.xfdiv2{z-index:999;position:fixed;bottom:350upx;width:100upx;  line-height:100upx;background-color:#fbf8f9;text-align:center; left: 20upx; border-radius: 100upx;
height: 100upx; overflow: hidden;border:thin solid #d9d7d3; font-weight: bold; color:green; font-size:60upx;
}	
.foot2{padding: 10upx;z-index:999;position:fixed;bottom:100upx;left:0;width:750upx;}	
</style>
